<div class="bg-light lter b-b wrapper-md ng-scope">
    <h4 class="m-n font-thin">商户管理</h4>
    <button ui-sref="app.chain" class="btn-back btn btn-dark btn-sm btn-rounded">
        返回
    </button>
</div>

<div class="wrapper-md ng-scope" ng-controller="chainShopCtrl">

    <script type="text/ng-template" id="updateUserStatus.html">
        <div ng-include="'tpl/systemSetting/merchants_update_status.html'"></div>
    </script>
    <script type="text/ng-template" id="merchantsAudit.html">
        <div ng-include="'tpl/systemSetting/merchants_audit.html'"></div>
    </script>

    <div class="panel panel-default">
        <div class="row wrapper">
            <div class="col-sm-9">
                <form class="form-inline ng-pristine ng-valid">
                    <div class="form-group">
                        <label class="control-label">店铺名称</label>
                        <input type="text" ng-model="shop.name" class="input-sm form-control">
                    </div>
                    <div class="form-group">
                        <label class="control-label">状态</label>
                        <select class="input-sm form-control" ng-model="shop.auditStatus">
                            <option value="">全部</option>
                            <option value="0">待审核</option>
                            <option value="1">审核不通过</option>
                            <option value="2">审核通过</option>
                        </select>
                    </div>
                    <button ng-click="query()" class="btn btn-sm btn-default">查询</button>
                </form>
            </div>
  <!--          <div class="col-sm-3">
                <div class="pull-right">
                    <button class="btn btn-sm btn-info" ui-sref="app.merchantsAdd">新增商户</button>
                </div>
            </div>-->
            <div class="clearfix"></div>
        </div>
        <div class="table-responsive" ng-controller="updateMerchantsCtrl">
            <table class="table table-striped b-t b-light">
                <thead>
                    <tr>
                        <th>名称</th>
                        <th>地址</th>
                        <th>联系人</th>
                        <th>联系电话</th>
                        <th>行业</th>
                        <th>状态</th>
                        <th>账户状态</th>
                        <th>审核状态</th>
                        <th>近期是否调整</th>
                        <!--<th>到期时间</th>-->
                        <th width="140" class="text-center">操作</th>
                    </tr>
                </thead>
                <tbody>
                    <tr ng-repeat="m in list">
                        <td>{{m.name}}</td>
                        <td>{{m.address}}</td>
                        <td>{{m.linkman}}</td>
                        <td>{{m.mobilePhone}}</td>
                        <td>{{m.industryName}}</td>
                        <td>
                            <span class="badge bg-success" ng-if="m.status == 0">营业中</span>
                            <span class="badge bg-danger" ng-if="m.status == 1">休息中</span>
                            <span class="badge bg-danger" ng-if="m.status == 2">停业整顿</span>
                        </td>
                        <td>
                            <span class="badge bg-success" ng-if="m.systemUserStatus == 0">正常</span>
                            <span class="badge bg-danger" ng-if="m.systemUserStatus == 1">冻结</span>
                        </td>
                        <td>
                            <span class="badge bg-danger" ng-if="m.auditStatus == 0">待审核</span>
                            <span class="badge bg-danger" ng-if="m.auditStatus == 1">审核不通过</span>
                            <span class="badge bg-success" ng-if="m.auditStatus == 2">审核通过</span>
                        </td>
                        <td>
                            <span class="badge bg-success" ng-if="m.isRecentChange == 0">暂无调整</span>
                            <span class="badge bg-warning" ng-if="m.isRecentChange == 1">近期调整</span>
                        </td>
                        <!--<td>{{m.expireTime.split(" ")[0]}}</td>-->
                        <td class="t-btns text-right">
                            <a class="btn btn-sm btn-success" ui-sref="app.merchantsView({shopId:m.shopId})" target="_blank">查看</a>
                            <!--<a class="btn btn-sm btn-info" ui-sref="app.chainShopEdit({shopId:m.shopId})">修改</a>-->
                            <div class="btn-group dropdown" dropdown="">
                                <button class="btn btn-sm btn-default" dropdown-toggle=""
                                        aria-haspopup="true" aria-expanded="false">更多 <span class="caret"></span>
                                </button>
                                <ul class="dropdown-menu">
                                    <li><a href="" ui-sref="app.merchantsGoods({shopId:m.shopId})" target="_blank">查看商品</a></li>
                                    <li>
                                        <a ng-click="openUpdateStatus(m.shopId,1,m.name)" ng-if="m.systemUserStatus == 0">冻结账户</a>
                                        <a ng-click="openUpdateStatus(m.shopId,0,m.name)" ng-if="m.systemUserStatus == 1">解冻账户</a>
                                    </li>
                                    <li><a ng-click="openMerchantsAudit(m.shopId,m.name,2)"  ng-if="m.auditStatus == 0 || m.auditStatus==1">审核通过</a></li>
                                    <li><a ui-sref="app.merchantsAuditFail({id:m.shopId})"  ng-if="m.auditStatus == 0">审核不通过</a></li>
                                </ul>
                            </div>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
        <footer class="panel-footer">
            <div class="row">
                <div class="col-sm-4 hidden-xs">
                    <!--<button class="btn btn-sm btn-default">批量冻结</button>
                    <button class="btn btn-sm btn-default">批量删除</button>-->
                </div>
                <div class="col-sm-4 text-center">
                    <small class="text-muted inline m-t-sm m-b-sm">显示第 {{startRow}} 至 {{endRow}} 项结果，共 {{totalItems}} 项</small>
                </div>
                <div class="col-sm-4 text-right text-center-xs">
                    <pagination boundary-links="true" total-items="totalItems" ng-model="currentPage"
                                ng-change="pageChanged()" max-size="{{maxPageRow}}" class="pagination-sm m-t-none m-b"
                                previous-text="上一页" next-text="下一页"
                                first-text="首页" last-text="尾页"></pagination>
                </div>
            </div>
        </footer>
    </div>
</div>
